﻿@model ScrumPilot.Domain.Models.Project
@{
    ViewBag.Title = "Project  |  " + Model.Name;
    Boolean isAdmin = ScrumPilot.Helpers.SPHelpers.IsAdmin(int.Parse(this.User.Identity.Name));
    string usrViewAction = Url.Action("UserView", "Home");
    usrViewAction = usrViewAction.Substring(0, usrViewAction.LastIndexOf('/'));
}
@section HeadContent{
    <link href="@Url.Content("~/Content/Project.css")" rel="stylesheet" type="text/css" />
}
@section AddJavaScript
{
    <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js"></script>
    <script type="text/javascript" src=@Url.Content("~/Scripts/jquery-jtemplates.js")></script>
    <script type="text/javascript" src='@Url.Content("~/Scripts/Project.js")'></script>
    <script type="text/javascript">
        var myPage = new Project();
    </script>
}
@section JSDocumentReady
{
myPage.Ready();
}
@section PageOptionUrl
{
    '@Url.Action("ProjectKeys", "Config")','@Url.Action("ProjectIndicator", "Config")',
    '@Url.Action("WorkItemsList", "Shared")','@Url.Action("CheckedOutList", "Shared")',
    '@Url.Action("TaskScore", "Tasks")','@Url.Action("LastPrjActivities", "Config")'
}
@section PageOptionsOpt
{
    ProjectID:@Model.ID
}

<div id="mainstdcontent">
    <div style="float: left">
        <h2>@Model.Name@if (Model.Selected)
                       { <img alt="follow" title="You follow this project" src="@Url.Content("~/Content/img/Star.png")" /> }
        </h2>
        <h3>@Model.CurrentSprint</h3>
    </div>
    <script id="projectindicatorTemplate" type="text/x-jQuery-tmpl">
        @Html.Partial("ProjectIndicator")
    </script>
    <div id="taskid" class="mdiv" style="float: left; background-color: white!important">
        <table style="width: 100%; padding: 0px; margin: 0px;" border="0" cellpadding="2">
            <tr id="projectIndicators">
            </tr>
        </table>
    </div>
    @if (isAdmin)
    {
        <p style="clear: left">
            <a href="#" id="ModifyButton" onclick="return myPage.OpenUpdProject();">Modify</a>
        </p>
    }
    <div id="col1">
        <div id="col1_content" class="clearfix">
        </div>
    </div>
    <div id="col2">
        <div id="col2_content" class="clearfix">
            <div id="UserProjectList" class="ui-corner-all">
            </div>
            <div id="walluserlist" class="ui-corner-all">
            </div>
            <div id="checkedoutlist" class="ui-corner-all">
            </div>
        </div>
    </div>
    <div id="col3">
        <div id="col3_content" class="clearfix">
        </div>
        <!-- IE Column Clearing -->
        <div id="ie_clearing">
            &#160;
        </div>
    </div>
</div>
@if (isAdmin)
{
    <div id="dialog-comments" title="Modify project parameters" style="display: none">
        @using (Ajax.BeginForm("Project", "Config", null, new AjaxOptions { OnComplete = "return myPage.EditDialogComplete();" }, new { @id = "projectForm" }))
        {
            <div id="projectDetails">
                <h3>@Model.Name</h3>
                <p style="padding: 2px; margin: 2px">
                    Current sprint: @Html.DropDownListFor(model => model.CurrentSprint, new SelectList(Model.Iterations, "ID", "Name", Model.CurrentSprint), new { @style = "width:250px" })
                    @*   Current sprint: @Html.DropDownListFor(model => model.CurrentSprint, Model.Iterations, new { @style = "width:250px" })*@
                </p>
            </div>
            <div style="padding: 10px;">
                <label class="radio">
                    @Html.RadioButtonFor(model => model.Selected, true)
                    <span class="metro-radio">You follow this project</span>
                </label>
                <label class="radio">
                    @Html.RadioButtonFor(model => model.Selected, false)

                    <span class="metro-radio">You don't follow this project</span>
                </label>

            </div>
            <div style="padding: 10px;">
                @Html.CheckBoxFor(model => model.SubscribeCheckin)<label for="subCheckin">This project
                    have a subscription to Checkin events</label>
                <br />
                @Html.CheckBoxFor(model => model.SubscribeWIChanged)<label for="subWiChanged">This project
                    have a subscription to WorkItemSimpleForUser changed events</label>
            </div>
        }
    </div>
}
<script id="WallListBodyTemplate" type="text/x-jquery-tmpl">
    {#template MAIN}
 {#if $T!=null}
 <h3 class="ZeroPad">Last activities</h3>
    <ul>
        {#foreach $T as record}
    <li>
        <p><b>{$T.record.Sentence}</b></p>
        {#if $T.record.MoreInformation!=null}<p>{$T.record.MoreInformation}</p>
        {#/if}
            <p>
                <abbr class='timeago' title='{$T.record.ISO8601Date}'>{$T.record.ActionDate}</abbr>&nbsp;
                | <a href="/{$T.record.URLDetail}">Details</a> | <a href="#" onclick="return OpenCommentDiaglog({$T.record.ID});">Comments</a>
                {#if $T.record.ProjectName!=null} | Project: <b><a href='@Url.Action("Project", "Config")/{$T.record.ProjectID}'>{$T.record.ProjectName}</a></b>{#/if}
            </p>
        {#if $T.record.Comments!=null}<ul class="WallComments ui-corner-all">
            {#include ROW root=$T.record.Comments}
        </ul>
        {#/if}
    </li>
        {#/for}
    </ul>
    {#/template MAIN}
  {#template ROW}
    {#foreach $T as CMrecord}
       <li>
           <div>
               <a href="@usrViewAction/{$T.CMrecord.AuthorID}">
                   <img alt="{$T.CMrecord.Author}" Title="{$T.CMrecord.Author}" src="@Url.Action("ShowPhoto16")/{$T.CMrecord.AuthorID}" border="0" /></a>
           </div>
           <p class="WCTitle">
               <a href="@usrViewAction/{$T.CMrecord.AuthorID}">{$T.CMrecord.Author}</a>
               |
               <abbr class='timeago' title='{$T.CMrecord.ISO8601Date}'>{$T.CMrecord.Date}</abbr>
           </p>
           {#if $T.CMrecord.CanDelete}<a class="WCDC" href="#" onclick="return DeleteComment({$T.CMrecord.ID});"></a>{#/if}
           <p>{$T.CMrecord.Comment}</p>
       </li>
    {#/for}
  {#/template ROW}
  {#/else}
   <h3>No activity</h3>
    {#/if}
</script>
